﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="frmCRUDUsuario.aspx.cs" Inherits="SISLOG.Web.frmCRUDUsuario" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 98%;
        }
        .style2
        {
            width: 123px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <fieldset>
   <legend><asp:Label id="LabelTitulo" runat="server"></asp:Label></legend>
    <asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1" 
        DefaultMode="Edit" oniteminserted="FormView1_ItemInserted1" 
        onitemupdated="FormView1_ItemUpdated1" Width="309px" 
        style="margin-top: 0px">
        <EditItemTemplate>
            <table class="style1">
                <tr>
                    <td class="style2">
                        DNI:
                    </td>
                    <td>
                        <asp:TextBox ID="dniTexBox" runat="server" Text='<%# Bind("dni") %>' 
                            Width="160px" Enabled="False" />
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                        Nombres:</td>
                    <td>
                        <asp:TextBox ID="nombresTextBox" runat="server" Text='<%# Bind("nombres") %>' 
                            Width="160px" Enabled="False" />
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                        Apellido Paterno:</td>
                    <td>
                        <asp:TextBox ID="apellidoPaternoTextBox" runat="server" 
                            Text='<%# Bind("apellidoPaterno") %>' Width="160px" Enabled="False" />
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                        Apellido Materno:</td>
                    <td>
                        <asp:TextBox ID="apellidoMaternoTextBox" runat="server" 
                            Text='<%# Bind("apellidoMaterno") %>' Width="160px" Enabled="False" />
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                        Contraseña:</td>
                    <td>
                        <asp:TextBox ID="contraseniaTextBox" runat="server" 
                            Text='<%# Bind("contrasenia") %>' Width="160px" />
                    </td>
                </tr>
                <%--<tr>
                    <td class="style2">
                        Id Area:</td>
                    <td>
                        <asp:TextBox ID="IdArea" runat="server" 
                            Text='<%# Bind("IdArea") %>' />
                    </td>
                </tr>--%>
                <tr>
                    <td class="style2">
                        Area:</td>
                    <td>
                        <asp:DropDownList ID="DropDownList2" runat="server" 
                            DataSourceID="ObjectDataSourceA" DataTextField="NombreArea" 
                            DataValueField="IdArea" SelectedValue='<%# Bind("idArea") %>' 
                            Width="160px">
                        </asp:DropDownList>
                        <asp:ObjectDataSource ID="ObjectDataSourceA" runat="server" 
                            onobjectcreating="ObjectDataSourceA_ObjectCreating" 
                            SelectMethod="GetAllFromArea" TypeName="SISLOG.BusinessLogic.AreaBL">
                        </asp:ObjectDataSource>
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                        &nbsp;</td>
                    <td class="style2">
                        <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                            CommandName="Update" Text="Actualizar" />
                        &nbsp; &nbsp;
                        <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" 
                            CommandName="Cancel" Text="Cancelar" PostBackUrl="~/frmUsuario.aspx" />
                    </td>
                </tr>
            </table>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </EditItemTemplate>
        <InsertItemTemplate>
            <table class="style1">
                <tr>
                    <td class="style2">
                        Id Usuario:
                    </td>
                    <td>
                        <asp:TextBox ID="idUsuarioTextBox" runat="server" 
                            Text='0' Width="160px" Enabled="False" />
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                        DNI:
                    </td>
                    <td>
                        <asp:TextBox ID="dniTextBox" runat="server" Text='<%# Bind("dni") %>' 
                            Width="160px" />
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                        Nombres:</td>
                    <td>
                        <asp:TextBox ID="nombresTextBox" runat="server" Text='<%# Bind("nombres") %>' 
                            Width="160px" />
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                        Apellido Paterno:</td>
                    <td>
                        <asp:TextBox ID="apellidoPaternoTextBox" runat="server" 
                            Text='<%# Bind("apellidoPaterno") %>' Width="160px" />
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                        Apellido Materno:</td>
                    <td>
                        <asp:TextBox ID="apellidoMaternoTextBox" runat="server" 
                            Text='<%# Bind("apellidoMaterno") %>' Width="160px" />
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                        Contraseña:</td>
                    <td>
                        <asp:TextBox ID="contraseniaTextBox" runat="server" 
                            Text='<%# Bind("contrasenia") %>' Width="160px" />
                    </td>
                </tr>
                <%--<tr>
                    <td class="style2">
                        Id Area:</td>
                    <td>
                        <asp:TextBox ID="IdArea" runat="server" 
                            Text='<%# Bind("IdArea") %>' />
                    </td>
                </tr>--%>
                <tr>
                    <td class="style2">
                        Area:</td>
                    <td>
                        <asp:DropDownList ID="DropDownList2" runat="server" 
                            DataSourceID="ObjectDataSourceA" DataTextField="NombreArea" 
                            DataValueField="IdArea" SelectedValue='<%# Bind("idArea") %>' 
                            Width="160px">
                        </asp:DropDownList>
                        <asp:ObjectDataSource ID="ObjectDataSourceA" runat="server" 
                            onobjectcreating="ObjectDataSourceA_ObjectCreating" 
                            SelectMethod="GetAllFromArea" TypeName="SISLOG.BusinessLogic.AreaBL">
                        </asp:ObjectDataSource>
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                        &nbsp;</td>
                    <td class="style2">
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Insertar" />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:LinkButton ID="LinkButton2" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancelar" 
                            PostBackUrl="~/frmUsuario.aspx" />
                    </td>
                </tr>
            </table>                               
        </InsertItemTemplate>
        <ItemTemplate>
            idUsuario:
            <asp:Label ID="idUsuarioLabel" runat="server" Text='<%# Bind("idUsuario") %>' />
            <br />
            dni:
            <asp:Label ID="dniLabel" runat="server" Text='<%# Bind("dni") %>' />
            <br />
            nombres:
            <asp:Label ID="nombresLabel" runat="server" Text='<%# Bind("nombres") %>' />
            <br />
            apellidoPaterno:
            <asp:Label ID="apellidoPaternoLabel" runat="server" 
                Text='<%# Bind("apellidoPaterno") %>' />
            <br />
            apellidoMaterno:
            <asp:Label ID="apellidoMaternoLabel" runat="server" 
                Text='<%# Bind("apellidoMaterno") %>' />
            <br />
            contrasenia:
            <asp:Label ID="contraseniaLabel" runat="server" 
                Text='<%# Bind("contrasenia") %>' />
            <br />
            idArea:
            <asp:Label ID="idAreaLabel" runat="server" Text='<%# Bind("idArea") %>' />
            <br />
            Area:
            <asp:Label ID="AreaLabel" runat="server" Text='<%# Bind("Area") %>' />
            <br />
            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                CommandName="Edit" Text="Editar" />
            &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="Nuevo" />
        </ItemTemplate>
    </asp:FormView>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        DataObjectTypeName="SISLOG.BusinessEntities.Usuario" 
        InsertMethod="RegistrarUsuario" 
        onobjectcreating="ObjectDataSource1_ObjectCreating" 
        SelectMethod="GetFromUsuarioByIdUsuario" 
        TypeName="SISLOG.BusinessLogic.UsuarioBL" UpdateMethod="RegistrarUsuario">
        <SelectParameters>
            <asp:QueryStringParameter Name="idUsuario" QueryStringField="id" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
   </fieldset>
</asp:Content>
